home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
-
- Created: Monday, April 27, 1992 at 2:50 PM
- ServerEventIntf.h
- C Interface to the Macintosh Libraries
-
-
- Copyright Apple Computer, Inc. 1990-1992
- All rights reserved
-
- 4/10/95 JML Added alignment pragmas
-
- ************************************************************/
-
- #ifndef __APPLETALK__
- #include <AppleTalk.h>
- #endif
-
- #if GENERATINGPOWERPC
- #pragma options align=mac68k
- #endif
-
- /* Constants used in the tSEQEntry */
-
- /* The SEeventFlag bits in tSEQEntry specify when the server event handler would like to be called */
- /* SEeventFlag bits */
- enum {
- bCSEHAFPInDoRequest = 0, /* An AFP call is starting up (in DoRequest, about to be dispatched) */
- bCSEHAFPInSendResponse = 1, /* An AFP call has completed (in SendResponse, about to send out the response) */
- bCSEHServerBusy = 2, /* A new session is being denied because the server is busy (socket starvation event) */
- bCSEHServerShutdown = 3, /* The server just shut down */
- bCSEHServerControlCall = 4, /* A server control call has just completed */
- /* NOTE: The following server control calls do not cause a bCSEHServerControlCall server event: */
- /* SCStartServer, SCInstallServerEventProc, SCRemoveServerEventProc, SCGetServerEventProc, SCServerVersion, and SCWakeServer. */
- /* You can use the bCSEHServerStartup server event to detect server starts and wakeups. */
- bCSEHShare = 5, /* An HFS Share trap has just completed */
- bCSEHUnShare = 6, /* An HFS UnShare trap has just completed */
- bCSEHSetDirAccess = 7, /* An HFS SetDirAccess trap has just completed */
- bCSEHServerNameChange = 8, /* An attempt was made to change the server name (the attempt may or may not have been successful) */
- bCSEHVolumePrep = 9, /* A new volume was just prepared for use with AppleShare */
- bCSEHVolumeUnmount = 10, /* A volume unmount was attempted on an AppleShare volume */
- bCSEHServerStartup = 11, /* The server just successfully started up */
- bCSEHSessionTornDown = 12, /* A user's session was torn down because any one of a number of reasons, including a */
- /* disconnect, server shutdown, timeout, or workstation initiated close session */
- bCSEHOutOfSequence = 13, /* A packet was received out of sequence; the session may be a zombie */
- bCSEHWksClosedSession = 14, /* A workstation closed its ASP session (i.e., it logged out) */
- bCSEHSessionTimedOut = 15, /* A workstation's session timed out */
- bCSEHSrvrClosedSession = 16 /* The server has closed a workstation's session */
- };
-
- /* When SEeventFlag bits bCSEHAFPInDoRequest or bCSEHAFPInSendResponse are set, the bits in SEwhichAFPFlag */
- /* determine which AFP calls will cause the server event handler to be called. */
- /* SEwhichAFPFlag bits */
- /* bit 0 of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 192 (afpAddIcon) */
- /* bit 1 of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 1 */
- /* bit 2 of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 2 */
- /* ... */
- /* bit 31 of SEwhichAFPFlag[1] - call SE handler when AFPCommand = 31 */
- /* bit 0 of SEwhichAFPFlag[0] - call SE handler when AFPCommand = 32 */
- /* ... */
- /* bit 63 of SEwhichAFPFlag[0] - call SE handler when AFPCommand = 63 */
-
-
- /* When SEeventFlag bit bCSEHServerControlCall is set, the bits in SEwhichSCFlag determine */
- /* which server control calls will cause the server event handler to be called. */
- /* SEwhichSCFlag bits */
- /* bit 0 of SEwhichSCFlag - call SE handler when scCode = 0 (SCStartServer) */
- /* ... */
- /* bit 31 of SEwhichSCFlag - call SE handler when scCode = 31 */
-
-
- #define BufferMax 48 /* maximum size of the Buffer in the ServerEventRecord */
-
- struct ServerEventRecord {
- long theEventNumber; /* the server event that's occuring; see the SEeventFlag definitions above */
- long theServerTime; /* the server time (in Macintosh DateTime form) */
- OSErr theResult; /* the result of the operation */
- /* if theEventNumber = bCSEHAFPInSendResponse: the AFP Error code to be returned */
- /* if theEventNumber = bCSEHServerControlCall: the result of the server control call */
- /* if theEventNumber = bCSEHShare, bCSEHUnShare, or bCSEHSetDirAccess: the result of the HFS call */
- /* if theEventNumber = bCSEHServerNameChange: the result of a PRegisterName call, SECantRegNameErr, or SEDupNameErr */
- /* if theEventNumber = bCSEHVolumeUnmount: noErr or fBsyErr (if volume is being used by a remote user) */
- /* all other values of theEventNumber return noErr */
- short theBufSize; /* the number of bytes used in theBuffer */
- Byte theBuffer[BufferMax];
- /* if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse: the first BufferMax bytes of the AFP packet */
- /* if theEventNumber = bCSEHServerControlCall: the first BufferMax bytes of the SCParamBlockRec */
- /* if theEventNumber = bCSEHShare, bCSEHUnShare, bCSEHSetDirAccess, bCSEHVolumePrep, or bCSEHVolumeUnmount: */
- /* the first BufferMax bytes of the HParamBlockRec */
- /* if theEventNumber = bCSEHServerNameChange: the new server name (in a Pascal string) */
- /* all other values of theEventNumber return a zero length buffer */
- Str31 theNameStr; /* the name of the file, if any; not always defined */
- short theAFPCommand; /* if theEventNumber = bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, the AFP call number */
-
- /* Note: If theEventNumber is bCSEHAFPInDoRequest, bCSEHAFPInSendResponse, bCSEHSessionTornDown, bCSEHOutOfSequence, */
- /* bCSEHWksClosedSession, bCSEHSessionTimedOut, or bCSEHSrvrClosedSession, then theUNRecID, theUNSUserID, */
- /* theUserName, and theSocketAddress of the user that made the call are returned. */
-
- long theUNRecID; /* the UNRecID of the user that made the call */
- long theUNSUserID; /* the UserID of the user that made the call */
- Str31 theUserName; /* the name of the user that made the call */
-
- /* Note: If theEventNumber is bCSEHAFPInDoRequest or bCSEHAFPInSendResponse, then theVRefNum and theDirID will be */
- /* returned if applicable to the AFP call */
-
- short theVRefNum; /* the VRefNum of the volume upon which this operation was performed (not always applicable) */
- long theDirID; /* the DirID of the directory upon/within which this operation was performed (not always applicable) */
- AddrBlock theSocketAddress; /* the network address of the user's workstation in AddrBlock format */
- };
-
- #ifndef __cplusplus
- typedef struct ServerEventRecord ServerEventRecord;
- #endif // __cplusplus
-
- typedef ServerEventRecord *ServerEventRecordPtr;
-
- struct tSEQEntry {
- ATQEntry SEQentry; /* a regular AppleTalk Transition Queue entry */
- long SEeventFlag; /* specifies when the Server Event Handler would like to be called */
- long SEwhichAFPFlag[2]; /* specifies which AFP calls will cause the Server Event Handler to be called */
- long SEwhichSCFlag; /* specifies which Server Control calls will cause the Server Event Handler to be called */
- };
-
- #ifndef __cplusplus
- typedef struct tSEQEntry tSEQEntry;
- #endif // __cplusplus
-
- typedef tSEQEntry *tSEQEntryPtr;
-
- #if GENERATINGPOWERPC
- #pragma options align=reset
- #endif
-